New: CD tray ejected on hibernate resume
https://bugzilla.kernel.org/show_bug.cgi?id=213759
Bug ID: 213759
Summary: CD tray ejected on hibernate resume
Product: SCSI Drivers
Version: 2.5
Kernel Version: 5.10.48
Hardware: x86-64
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: Other
Assignee: [email protected]
Reporter: [email protected]
Regression: NoAfter resuming from hibernation (shutdown-disk), CD tray (which is empty and untouched) is ejected on resume. I use a LUKS-encrypted root partition, and the tray is always ejected before my distro NixOS (cryptsetup) prompts for my key.
I bi-sect'd the problem commit down to this one:
From: ManYi Li <[email protected]>
To: [email protected], [email protected], [email protected]
Cc: [email protected], [email protected],
ManYi Li <[email protected]>
Subject: [PATCH] sr: Fix get the error media event code
Date: Fri, 11 Jun 2021 17:44:02 +0800
Message-ID: <[email protected]> (raw)
Eject the specified slot or media through a mechanical switch on the Drive, med->media_event_code is 3 not 1 in the sr_get_events().
If disk_flush_events() and sr_block_open() are called, clearing is 1 or 3 in the sr_check_events(),then it report DISK_EVENT_MEDIA_CHANGE not DISK_EVENT_EJECT_REQUEST.
If disk_flush_events() and sr_block_open() aren't called, clearing is 0 in the sr_check_events(),then it doesn't report any event.
--- drivers/scsi/sr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/sr.c +2 -0
@@ -220,6 +220,8 @@ static unsigned int sr_get_events(struct scsi_device *sdev)return DISK_EVENT_EJECT_REQUEST ; else if (med->media_event_code == 2) return DISK_EVENT_MEDIA_CHANGE; + else if (med->media_event_code == 3) + return DISK_EVENT_EJECT_REQUEST;return 0 ; }
That commit was backported onto a number of kernels, so I can reproduce this on a number of different kernels (master, stable, LTS). I'm not sure if this is a bug in the CD-reader (tossing back an incorrect status), or if the bug is within this driver?
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
https://bugzilla.kernel.org/show_bug.cgi?id=213759
[email protected] changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected] Regression|No |Yes
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
[email protected] changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #1 from [email protected] ---
Also seeing this problem on resume from suspend on a completely different system than the above user's system.
Can we please get this fixed ASAP? Its a very annoying issue. Thank you.
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
limanyi ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #2 from limanyi ([email protected]) --- I'm the author of this patch:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.14-rc2&id=7dd753ca59d6c8cc09aa1ed24f7657524803c7f3
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
--- Comment #3 from [email protected] ([email protected]) --- Seeing this problem on Linux 5.14-rc2, CD tray (which is empty and untouched) is ejected on resume from hibernation.I'm looking for the root cause of the problem.
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
Todd Lyons ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #4 from Todd Lyons ([email protected]) ---
Glad to see this isn't just me with the DVD-ROM tray snapping out on wake. I first noticed it with 5.13.2. Hope to see this squashed soon. Thank you.
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
Jonne Ransijn ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #5 from Jonne Ransijn ([email protected]) --- The description for media event code 3 reads:
MediaRemoval
The media has been removed from the specified slot,
and the Drive is unable to access the media without user intervention. This applies to media changers only.
This seems like a reasonable status notification after the disk drive detected no disk in the drive.
How else could the the drive signal that the user removed a disk while the kernel is suspended? The disk drive is (presumably) stateless, it doesn't remember if it used to have a disk inserted.
This doesn't seem like a bug in the disk drive.
I'm pretty sure 'DISK_EVENT_EJECT_REQUEST' is not the correct event in this case.
It seems more reasonable to send a 'DISK_EVENT_MEDIA_CHANGE'.
Also, the description for media event code 4:
MediaChanged
The user has requested that the media in the specified slot be loaded. This applies to media changers only.
Should probably send a 'DISK_EVENT_MEDIA_CHANGE' for that as well then.
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
--- Comment #6 from [email protected] ([email protected]) --- I agree to send a 'DISK_EVENT_MEDIA_CHANGE' instead of 'DISK_EVENT_EJECT_REQUEST' when media event code is 3.
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
--- Comment #7 from [email protected] ([email protected]) ---
1. modify the file /lib/udev/rules.d/60-cdrom_id.rules:
-ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end"
+#ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end"
2. systemctl restart udev.service
I find that CD tray isn`t ejected on resume. I think that the kernel should not send 'DISK_EVENT_EJECT_REQUEST' when media event code is 3.
This patch solves this problem:
drivers/scsi/sr.c +1 -1
@@ -221,7 +221,7 @@ static unsigned int sr_get_events(struct scsi_device *sdev)else if (med->media_event_code ==2 )return DISK_EVENT_MEDIA_CHANGE ;else if (med->media_event_code ==3 ) -return DISK_EVENT_EJECT_REQUEST ; +return DISK_EVENT_MEDIA_CHANGE ;return 0 ; }
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
[email protected] changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #8 from [email protected] ---
FWIW I'm seeing the same issue with Hyper-V Generation 2 VMs. After
commit 7dd753ca59d6c8cc09aa1ed24f7657524803c7f3
Author: ManYi Li <[email protected]> Date: Fri Jun 11 17:44:02 2021 +0800
scsi: sr: Return appropriate error code when disk is ejected
DISK_EVENT_EJECT_REQUEST is generated when storvsc driver loads and in case there's a udev rule to do "cdrom_id --eject-media ... " at this time the virtual CDROM goes away.
Patch from https://bugzilla.kernel.org/show_bug.cgi?id=213759#c7 helps.
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
Jerick Fischer ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #9 from Jerick Fischer ([email protected]) --- Is there a solution to this already? I hope this will be solved soon.
RJ | https://www.sanantoniotruckingpros.com/
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
[email protected] changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |CODE_FIX--- Comment #10 from [email protected] ---
Can confirm the patch in #7 fixes the issue (in trunk, backported as well). Thanks for the great work @limanyi, issue resolved.
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
jeffro ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #11 from jeffro ([email protected]) ---
Also encountering this issue on Ubuntu 18.04 LTS as of last kernel update to 4.15.0.156-generic. CD tray only ejects after resume from suspend, not on boot (No disk in the drive). Previous kernel (4.15.0.154-generic) does not exhibit this behavior.
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
--- Comment #12 from jeffro ([email protected]) ---
After today's Ubuntu 18.04 LTS kernel update to 4.15.0.158-generic the CD tray eject problem still persists.
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
Ahmed Sayeed ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #13 from Ahmed Sayeed ([email protected]) ---
/gdb/arch/arc.c:117:43: required from here http://www.compilatori.com//usr/include/c++/4.8.2/bits/hashtable_policy.h:195:39: error: no matching function for call to ‘std::pair<const arc_arch_features, const std::unique_ptr<target_desc, http://www-look-4.com/ target_desc_deleter>
Quoted 1 line
::pair(const arc_arch_features&, target_desc*&)’
: _M_v(std::forward<_Args>(__args)...) { } http://www.acpirateradio.co.uk/
^ /usr/include/c++/4.8.2/bits/hashtable_policy.h:195:39: note: candidates are: https://www.webb-dev.co.uk/ In file included from /usr/include/c++/4.8.2/utility:70:0, from /usr/include/c++/4.8.2/tuple:38, http://www.logoarts.co.uk/ from /usr/include/c++/4.8.2/functional:55, from ../../gdb/../gdbsupport/ptid.h:35, https://komiya-dental.com/ from ../../gdb/../gdbsupport/common-defs.h:123, from ../../gdb/arch/arc.c:19: http://www.slipstone.co.uk/
/usr/include/c++/4.8.2/bits/stl_pair.h:206:9: note: template<class ... _Args1, long unsigned int ..._Indexes1, class ... _Args2, long unsigned int ..._Indexes2> std::pair<_T1, http://embermanchester.uk/
_T2>::pair(std::tuple<_Args1 ...>&, std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>, std::_Index_tuple<_Indexes2 ...>)
pair(tuple<_Args1...>&, tuple<_Args2...>&, http://connstr.net/ ^
-------->8---------
http://joerg.li/
Thanks to Tome de Vries' investigation, same fix applies in ARC's case as well:
--------8<--------- http://www.jopspeech.com/
gdb/arch/arc.c http://www.wearelondonmade.com/ renamed from gdb/arch/arc.c +0 -0
@@ -114,7 +114,7 @@ struct arc_arch_features_hasher target_desc *tdesc = arc_create_target_description (features);
/* Add the newly created target description to the repertoire. */
- arc_tdesc_cache.emplace (features, tdesc); http://www.iu-bloomington.com/
+ arc_tdesc_cache.emplace (features, target_desc_up (tdesc));
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
Earl McConnell ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #14 from Earl McConnell ([email protected]) --- The issue is still reproducible with the Linus kernel as it stands, however it is no longer reproducible with the fixes I have queued in my tree. Specifically:
d0e36a62bd4c "quota: correct error number in free_dqentry()". 9bf3d2033129 "quota: check block number when reading the block in quota file". Can be found at
https://googleprojectzero.blogspot.com/2017/04/over-air-exploiting-broadcoms-wi-fi_4.html
https://geometrydashworld.net
Alludes to this entry on Bugzilla. Perhaps the following changes to nvme_dev_ioctl will strengthen the driver.
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
Sanchez ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #15 from Sanchez ([email protected]) ---
Magque: The Intersection of Digital hosts regular events and showcases where users can present their work, gain feedback, and network with industry leaders. These events provide valuable opportunities for collaboration and exposure, helping users to grow their careers and gain recognition in the digital creative landscape.
Read more: https://getreleasenow.com/magque/
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
Peltier ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #16 from Peltier ([email protected]) ---
The Yamaha XSR 300 distinguishes itself with its ability to cater to diverse rider needs. Its harmonious blend of retro design and modern functionality, coupled with Yamaha's engineering prowess, ensures a bike that’s as reliable as it is stylish.
https://wheel4world.com/yamaha-xsr-300-overview-design-engine-specs-and-price-in-india/
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
Backhoe ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #17 from Backhoe ([email protected]) ---
The CB 1CXT Backhoe Loader is a powerful, compact, and versatile machine designed to handle a wide variety of construction, landscaping, and agricultural tasks.
https://newcarbike.com/cb-1cxt-backhoe-loader-a-compact-machine-built/
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
Wheel4x4 ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #18 from Wheel4x4 ([email protected]) ---
, Wheel4x4 is the brand you need to know. Known for rugged performance, innovation, and a passion for all things 4x4, Wheel4x4 caters to everyone from weekend warriors to seasoned trail explorers.<a href="https://wheel4x4.com/">Wheel4x4</a>
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
world4vehical ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #19 from world4vehical ([email protected]) --- The XXC Renegade 1000 XXC is a high-performance ATV built for aggressive riders who crave power and precision on challenging terrains. Equipped with a 976cc Rotax V-Twin engine, it delivers exceptional acceleration and torque, making it ideal for off-road adventures. The Renegade 1000 XXC features FOX suspension, a lightweight yet tough chassis, and premium tires.Read More:
https://world4vehical.com/xxc-renegade-1000-xxc-power-speed-price-breakdown/
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
clarkbrown ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #20 from clarkbrown ([email protected]) ---
With EFI, long-travel suspension, and a race-built frame, the Yamaha YFZ450R sets the standard for modern sport ATVs.
https://world4cars.com/2025/07/09/yamaha-yfz450r-review/
https://world4carsreviews.blogspot.com/
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.
[Bug 213759] CD tray ejected on hibernate resume
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=213759
[email protected] changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #21 from [email protected] ---
Car wheels are circular components that enable a vehicle to move by rotating on an axle.
https://wheelles.com/
Signature · 5 lines
You may reply to this email to add a comment. You are receiving this mail because: You are on the CC list for the bug. You are watching the assignee of the bug.